<%@ page contentType="text/html; charset=GBK"  %>
<%@ page import="com.ionglobal.db.*" %>
<%@ page import="java.util.*" %>
<%@ page import="com.ionglobal.lib.*" %>
<%@page import="com.ionglobal.misc.Sysop" %>
<%@page import="com.gzgi.weqs.refquote.ReqPlan"%>
<%@page import="com.gzgi.weqs.refquote.ReqPlanApp"%>
<%@page import="java.text.SimpleDateFormat"%>
<%@page import="org.json.*"%>
<%@ include file="/include/init_include.jsp" %>
<% 
	Sysop sysop = (Sysop)session.getAttribute("sysop");
	int planId = Request.getInt("planid", 0);
	ReqPlan reqplan = new ReqPlan() ;
	reqplan.setId(planId);
	JSONObject jsonObject = new JSONObject();
	reqplan.setSendDate(Request.getDate("reqplandate")) ;
	reqplan.setSendType(Request.getString("reqplantype")) ;
	reqplan.setCarType(Request.getString("carno")) ;
	reqplan.setSupplierNo(Request.getString("suppno")) ;
	reqplan.setPartsNo(Request.getString("partsno")) ;
	reqplan.setCreator(sysop.getName()) ;
	reqplan.setCreateDate(new Date()) ;
	reqplan.setModifier(sysop.getName()) ;
	reqplan.setModifyDate(new Date()) ;
	reqplan.setStuffPriceId(Request.getInt("stuffpriceid", 0));
	reqplan.setExchangeConditionId(Request.getInt("exchangeid", 0));
	reqplan.setPartEffectDate(Request.getDate("parteffectdate", new Date()));
	
    String mothod = request.getParameter("mothod") ;
    
    ReqPlanApp app = new ReqPlanApp() ;
	if(mothod.equals("reqplantypelist")){
	  out.print(app.reqplantypelist(dbi)) ;
	}else if(mothod.equals("cartypelist")){
	 out.print(app.cartypelist(dbi)) ;
	}else if(mothod.equals("insert")){
	   if(app.selectItemForInsert(reqplan,dbi)){
		   jsonObject.put("errorCode", "1");
	   }else{
	       jsonObject.put("errorCode", "2");
	   }
	  out.print(jsonObject);
	}
%>
<%@ include file="/include/init_free.jsp" %>